<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="close"
    cancelText="关闭">
    <a-card :bordered="false">
      <!-- table区域-begin -->
      <div>
        <a-table
          ref="table"
          size="middle"
          :scroll="{x:true}"
          bordered
          rowKey="id"
          :columns="columns"
          :dataSource="dataSource"
          :pagination="ipagination"
          :loading="loading"
          :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
          class="j-table-force-nowrap"
          @change="handleTableChange">

          <template slot="imgSlot" slot-scope="text,record">
<!--            <span v-if="record.contentType='1'" style="font-size: 12px;font-style: italic;">-->
            <span style="font-size: 12px;font-style: italic;">
              <img v-if="record.contentType=='1'" :src="text" preview height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
              <audio v-else ref="audioPlayer" :src="text" style="height: 25px" controls></audio>
            </span>
<!--            <span v-else>
              <audio controls>
                <source :src="text">
              </audio>
            </span>-->
          </template>
        </a-table>
      </div>
    </a-card>
  </j-modal>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'

  export default {
    name: 'RoomAuditList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
    },
    data () {
      return {
        description: '违规列表',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'违规用户id',
            align:"center",
            dataIndex: 'userId'
          },
          {
            title:'违规用户昵称',
            align:"center",
            dataIndex: 'userName'
          },
          /*{
            title:'审核任务媒体类型 1-图片 2-声音',
            align:"center",
            dataIndex: 'contentType'
          },
          {
            title:'审核类型 1、视频 2、音频',
            align:"center",
            dataIndex: 'scene'
          },
          {
            title:'命中问题的严重程度',
            align:"center",
            dataIndex: 'riskLevel'
          },
          {
            title:'审核命中的违规策略类型',
            align:"center",
            dataIndex: 'riskType'
          },*/
          {
            title:'违规发生的时间',
            align:"center",
            dataIndex: 'riskTime'
          },
          {
            title:'截图或声音片段地址',
            align:"center",
            dataIndex: 'contentUrl',
            scopedSlots: { customRender: 'imgSlot' }
          },
          {
            title:'问题详情描述',
            align:"center",
            dataIndex: 'textDesc'
          },
        ],
        url: {
          list: "/message/roomAudit/list",
          delete: "/message/roomAudit/delete",
          deleteBatch: "/message/roomAudit/deleteBatch",
          exportXlsUrl: "/message/roomAudit/exportXls",
          importExcelUrl: "message/roomAudit/importExcel",

        },
        dictOptions:{},
        superFieldList:[],

        disableMixinCreated:true,
        title:'违规列表',
        width:1200,
        visible: false,
        disableSubmit: true
      }
    },
    created() {
    //this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
      close () {
        this.visible = false;
      },
      show(roomId){
        this.queryParam.roomId = roomId;
        this.loadData();
        this.visible = true;
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>